Skip to content

Fixes for stricter compilers#1703

Merged
rapids-bot[bot] merged 6 commits intorapidsai:mainfrom
maxwbuckley:patch-6
Feb 7, 2026
Merged

Fixes for stricter compilers#1703
rapids-bot[bot] merged 6 commits intorapidsai:mainfrom
maxwbuckley:patch-6

Conversation

@maxwbuckley
Copy link
Contributor

Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable

Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable
@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 14, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@mythrocks
Copy link
Contributor

mythrocks commented Jan 14, 2026

Thank you for your contribution. Much appreciated.

Looking at your other PRs, would you be opposed to combining them into this PR (#1703)?

  1. Remove unused variable n_rows #1704
  2. Remove unused use_norms constant from kernel_sm60.cuh #1705
  3. Remove unused variable read_idx from query loop #1706

We can test these together.

We can set the title for this PR to say Miscellaneous fixes for code hygiene.

for (uint32_t j = 0; j < num_distilation; j++) {
// Select a node randomly and compute the distance to it
IndexT seed_index;
IndexT seed_index = 0;
Copy link
Contributor

@mythrocks mythrocks Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely convinced that there is a problem here. seed_index's uninitialized value isn't read.

But this does indicate that this can be tightened up.

Comment on lines -118 to 126
IndexT seed_index;
IndexT seed_index = 0;
if (valid_i) {
// uint32_t gid = i + (num_pickup * (j + (num_distilation * block_id)));
uint32_t gid = block_id + (num_blocks * (i + (num_pickup * j)));
if (seed_ptr && (gid < num_seeds)) {
seed_index = seed_ptr[gid];
} else {
seed_index = device::xorshift64(gid ^ rand_xor_mask) % dataset_desc.size;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An argument can be made to use an IIFE for this variable. That would also allow it to be const:

IndexT const seed_index = [&] {
  if (valid_i) {
    // uint32_t gid = i + (num_pickup * (j + (num_distilation * block_id)));
    uint32_t gid = block_id + (num_blocks * (i + (num_pickup * j)));
    if (seed_ptr && (gid < num_seeds)) {
      return seed_ptr[gid];
    } else {
      return device::xorshift64(gid ^ rand_xor_mask) % dataset_desc.size;
    }
  }
}();

@mythrocks mythrocks added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jan 14, 2026
case 3: x += raft::shfl_xor(x, 4);
case 2: x += raft::shfl_xor(x, 2);
case 1: x += raft::shfl_xor(x, 1);
case 5: x += raft::shfl_xor(x, 16); [[fallthrough]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@cjnolet
Copy link
Member

cjnolet commented Jan 14, 2026

/ok to test 9827f5a

@cjnolet
Copy link
Member

cjnolet commented Jan 30, 2026

/ok to test 8db9f00

@cjnolet
Copy link
Member

cjnolet commented Jan 30, 2026

/merge

@cjnolet
Copy link
Member

cjnolet commented Feb 7, 2026

/ok to test e5263f4

@rapids-bot rapids-bot bot merged commit 6411798 into rapidsai:main Feb 7, 2026
92 checks passed
benfred pushed a commit to benfred/cuvs that referenced this pull request Feb 10, 2026
Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable

Authors:
  - Max Buckley (https://github.com/maxwbuckley)
  - MithunR (https://github.com/mythrocks)
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#1703
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Development

Successfully merging this pull request may close these issues.

3 participants